{% load display_tags %}
{% load authorization_tags %}

{% if include_view %}
    <li role="presentation">
        <a href="{% url 'view_risk_acceptance' engagement.id risk_acceptance.id %}?return_url={{ request.get_full_path|urlencode }}">
            <i class="fa-solid fa-rectangle-list"></i> View Risk Acceptance
        </a>
    </li>
{% endif %}

{% if engagement.product.enable_full_risk_acceptance %}
    {% if engagement|has_object_permission:"Risk_Acceptance" %}
        <li role="presentation">
            <a href="{% url 'edit_risk_acceptance' engagement.id risk_acceptance.id %}?return_url={{ request.get_full_path|urlencode }}">
                <i class="fa-solid fa-pen-to-square"></i> Edit Risk Acceptance
            </a>
        </li>
        <li role="separator" class="divider"></li>
        {% if risk_acceptance.is_expired %}
            <li role="presentation">
                <a class="reinstate-risk_acceptance" href="{% url 'reinstate_risk_acceptance' engagement.id risk_acceptance.id %}?return_url={{ request.get_full_path|urlencode }}">
                    <i class="fa-solid fa-backward-fast"></i> Reinstate
                </a>
            </li>
        {% else %}
            <li role="presentation">
                <a class="expire-risk_acceptance" href="{% url 'expire_risk_acceptance' engagement.id risk_acceptance.id %}?return_url={{ request.get_full_path|urlencode }}">
                    <i class="fa-solid fa-forward-fast"></i> Expire Now
                </a>
            </li>
        {% endif %}
    {% endif %}
{% endif %}
<li role="separator" class="divider"></li>
<li role="presentation">
<a href="{% url 'action_history' risk_acceptance|content_type risk_acceptance.id %}">
    <i class="fa-solid fa-clock-rotate-left"></i> View History
</a>
</li>
{% if engagement|has_object_permission:"Risk_Acceptance" %}
<li role="separator" class="divider"></li>
<li role="presentation">
    <a class="text-danger delete-risk_acceptance" href="#">
        <i class="fa-solid fa-trash"></i> Delete Risk Acceptance
    </a>
    <form id="delete-risk_acceptance-form-{{risk_acceptance.id}}" method="post" action="{% url 'delete_risk_acceptance' engagement.id risk_acceptance.id %}" >
        {% csrf_token %}
        <input type="hidden" label="delete_risk_acceptance" aria-label="delete_risk_acceptance" name="id" value="{{ risk_acceptance.id }}"/>
    </form>
</li>
{% endif %}
